package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.DealerInfoExtMapper;
import com.mhc.suzuki.dal.model.DealerInfoDO;
import com.mhc.suzuki.dal.query.DealerInfoQuery;
import com.mhc.suzuki.manager.DealerInfoManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for DealerInfo.
 */

@Component
public class DealerInfoManagerImpl implements DealerInfoManager {


    @Autowired
    protected DealerInfoExtMapper dealerInfoExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(DealerInfoQuery query) {
        return dealerInfoExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(DealerInfoQuery query) {
        return dealerInfoExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(DealerInfoDO record) {
        return dealerInfoExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(DealerInfoDO record) {
        return dealerInfoExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<DealerInfoDO> selectByQuery(DealerInfoQuery query) {
        return dealerInfoExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<DealerInfoDO> selectByQueryWithPage(DealerInfoQuery query) {
        PageResult<DealerInfoDO> result = new PageResult<DealerInfoDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public DealerInfoDO selectByPrimaryKey(Long id) {
        return dealerInfoExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(DealerInfoDO record, DealerInfoQuery query) {
        return dealerInfoExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(DealerInfoDO record, DealerInfoQuery query) {

        return dealerInfoExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(DealerInfoDO record) {
        return dealerInfoExtMapper.updateByPrimaryKeySelective(record);
    }
}